package day08InnerClass;


public class Test2 {
    public static void main(String[] args) {
        Weapon w1 = f1();
        w1.kill();

        Weapon w2 = f2("青龙偃月刀");
        w2.kill();
    }

    private static Weapon f2(String name){
        Weapon w = new Weapon(){
            @Override
            public void kill() {
                System.out.println("拿"+name+"怼人");
            }
        };
        return w;
    }






    private static Weapon f1(){
        class AK47 implements Weapon{

            @Override
            public void kill() {
                System.out.println("抱着AK47突突");
            }
        }
        return new AK47();
    }
}

